#include "stdafx.h"
#include "emotionalmemory.h"
#include "goal_socialize.h"
#include "event.h"
using namespace BAA;


EmotionalMemory* BAA::Goal_Socialize::AppraiseEvent( Event * event )
{
	return NULL;
}

float BAA::Goal_Socialize::CalculateStateUtility( Agent * agent )
{
	float val = 1- abs(mSocialContactPoint - ParentRole()->Self()->Properties()->mSocialContact->Desire());
	return val;
}

float BAA::Goal_Socialize::CalculateUtilityForAction( Action * action )
{
	StringFloatMap * consequences = action->Consequences();
	float utility = (*consequences)["socialize"];

	// ASSUME

	// check to see if we are socializing with someone we care about. 

	// for the goals, check to see if the target is someone who this goal cares about.
	
	// quick check ( if the action is role parent is the goals role parent the true;
	if(action->RoleParent() == this->ParentRole())
	{
		return utility;
	}
	else
	{
		
		if(this->ParentRole()->TargetContainsAgent(action->GetTargets()))
			return utility;
		else
			return 0.0f;
	}
}